<?php
  
  require_once "framework.php";
     
             
    
  /*    $dataPage = new data();            
    $dataPage->getTable("app,_template",
                                        "_url = '" . mysql_real_escape_string($uri) . "' AND domain='$domain'");        */    
    
    
    
                
    $dataPage = new data();            
    $dataPage->getTable("app,_template",
                                        "_url = '" . mysql_real_escape_string($uri) . "'");            
    
   
   
   if ($dataPage->count>0) {
   
   
   $cmsData = $dataPage->data; 
   $cmsData['page_id'] = $cmsData['app_id'];
     //print_r($cmsData);
   
    //$templateFilename = "../code/template/".$cmsData['template_code'];     
    $templateFilename = "../code/template/admin.php";
    
    $codePath = "/code/app";
    global $pageTable;
    $pageTable = "app";
    
    
    require $templateFilename;   
    exit;
    
   } else {
       
      // echo "not found";
      // exit;
       
   } 
   
   
    
    
    
        

            //echo $sql;
            //$buffer = $buffer .$sql;

            //$dataPage =sqlQuery($sql);
            $dataPage=new data();
            //$dataPage->getQuery($sql);


                    $dataPage->getTable("$pageTable,_template",
                                        "_url = '" . mysql_real_escape_string($uri) . "' AND domain='$domain'");
           
                     
        
        
        if ($dataPage->count>0) {
   
   
   $cmsData = $dataPage->data; 
   //$cmsData['page_id'] = $cmsData['app_id'];
   
    
   } else {
       
       echo "not found";
       exit;
       
   } 
   
   //print_r($cmsData);
   
    $templateFilename = "../code/$domain/template/".$cmsData['template_code'];     
    
   // echo $templateFilename;
   // exit;
    
    
    $codePath = "/code/$domain/content";
    global $pageTable;
    $pageTable = "page";
    
    
    require $templateFilename;   
        
        
        
        
        
        
        
        
       
  
 
  
  
?>

